package com.lesson10.composite.ex;

/**
 * @author 朝花不迟暮
 * @version 1.0
 * @date 2020/10/2 13:04
 */
public class Test
{
    public static void main(String[] args)
    {
        Composite root = new Composite("root");
        root.add(new Leaf("111"));
        root.add(new Leaf("222"));
        Composite comp = new Composite("Composite X");
        comp.add(new Leaf("Leaf XA"));
        comp.add(new Leaf("Leaf XB"));
        root.add(comp);
        root.display(2);
    }
}
